home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / prog_bas / vbwarn.zip / FRMNEWP.FRM < prev    next >
Text File  |  1995-12-11  |  14KB  |  474 lines

  1. VERSION 2.00
  2. Begin Form frmNewP 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Add New Person"
  6.    ClientHeight    =   2145
  7.    ClientLeft      =   345
  8.    ClientTop       =   3015
  9.    ClientWidth     =   8955
  10.    ControlBox      =   0   'False
  11.    Height          =   2550
  12.    Left            =   285
  13.    LinkTopic       =   "Form2"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   2145
  17.    ScaleWidth      =   8955
  18.    Top             =   2670
  19.    Width           =   9075
  20.    Begin CommandButton cmdCancel 
  21.       Caption         =   "&Cancel Add and Return To Ticket"
  22.       Height          =   375
  23.       Left            =   4920
  24.       TabIndex        =   18
  25.       Top             =   1620
  26.       Width           =   3135
  27.    End
  28.    Begin CommandButton cmdSave 
  29.       Caption         =   "&Save Person and Add To Ticket"
  30.       Height          =   375
  31.       Left            =   840
  32.       TabIndex        =   17
  33.       Top             =   1620
  34.       Width           =   2955
  35.    End
  36.    Begin Data dtaPerson 
  37.       BackColor       =   &H00C0C0C0&
  38.       Caption         =   "Person"
  39.       Connect         =   ""
  40.       DatabaseName    =   "VBWARN.MDB"
  41.       Exclusive       =   0   'False
  42.       Height          =   315
  43.       Left            =   1920
  44.       Options         =   0
  45.       ReadOnly        =   0   'False
  46.       RecordSource    =   "Person"
  47.       Top             =   120
  48.       Visible         =   0   'False
  49.       Width           =   1215
  50.    End
  51.    Begin TextBox txtFNameP 
  52.       BackColor       =   &H00C0C0C0&
  53.       DataField       =   "FName"
  54.       DataSource      =   "dtaPerson"
  55.       Height          =   315
  56.       Left            =   5760
  57.       TabIndex        =   1
  58.       Top             =   240
  59.       Width           =   1035
  60.    End
  61.    Begin TextBox txtLNameP 
  62.       BackColor       =   &H00C0C0C0&
  63.       DataField       =   "LName"
  64.       DataSource      =   "dtaPerson"
  65.       Height          =   315
  66.       Left            =   3720
  67.       TabIndex        =   0
  68.       Top             =   240
  69.       Width           =   1455
  70.    End
  71.    Begin TextBox txtInitialP 
  72.       BackColor       =   &H00C0C0C0&
  73.       DataField       =   "Initial"
  74.       DataSource      =   "dtaPerson"
  75.       Height          =   315
  76.       Left            =   7200
  77.       TabIndex        =   2
  78.       Top             =   240
  79.       Width           =   615
  80.    End
  81.    Begin TextBox txtCityP 
  82.       BackColor       =   &H00C0C0C0&
  83.       DataField       =   "City"
  84.       DataSource      =   "dtaPerson"
  85.       Height          =   315
  86.       Left            =   3720
  87.       TabIndex        =   4
  88.       Top             =   540
  89.       Width           =   1455
  90.    End
  91.    Begin TextBox txtDLStP 
  92.       BackColor       =   &H00C0C0C0&
  93.       DataField       =   "DLSt"
  94.       DataSource      =   "dtaPerson"
  95.       Height          =   315
  96.       Left            =   3720
  97.       TabIndex        =   8
  98.       Top             =   840
  99.       Width           =   495
  100.    End
  101.    Begin TextBox txtWeightP 
  102.       BackColor       =   &H00C0C0C0&
  103.       DataField       =   "Weight"
  104.       DataSource      =   "dtaPerson"
  105.       Height          =   315
  106.       Left            =   3720
  107.       TabIndex        =   14
  108.       Top             =   1140
  109.       Width           =   615
  110.    End
  111.    Begin TextBox txtStateP 
  112.       BackColor       =   &H00C0C0C0&
  113.       DataField       =   "State"
  114.       DataSource      =   "dtaPerson"
  115.       Height          =   315
  116.       Left            =   5760
  117.       TabIndex        =   5
  118.       Top             =   540
  119.       Width           =   495
  120.    End
  121.    Begin TextBox txtDLTypeP 
  122.       BackColor       =   &H00C0C0C0&
  123.       DataField       =   "DLType"
  124.       DataSource      =   "dtaPerson"
  125.       Height          =   315
  126.       Left            =   5760
  127.       TabIndex        =   9
  128.       Top             =   840
  129.       Width           =   795
  130.    End
  131.    Begin TextBox txtHairP 
  132.       BackColor       =   &H00C0C0C0&
  133.       DataField       =   "Hair"
  134.       DataSource      =   "dtaPerson"
  135.       Height          =   315
  136.       Left            =   5760
  137.       TabIndex        =   15
  138.       Top             =   1140
  139.       Width           =   795
  140.    End
  141.    Begin TextBox txtAddressP 
  142.       BackColor       =   &H00C0C0C0&
  143.       DataField       =   "Address"
  144.       DataSource      =   "dtaPerson"
  145.       Height          =   315
  146.       Left            =   960
  147.       TabIndex        =   3
  148.       Top             =   540
  149.       Width           =   2235
  150.    End
  151.    Begin TextBox txtDLP 
  152.       BackColor       =   &H00C0C0C0&
  153.       DataField       =   "DL"
  154.       DataSource      =   "dtaPerson"
  155.       Height          =   315
  156.       Left            =   960
  157.       TabIndex        =   7
  158.       Top             =   840
  159.       Width           =   1815
  160.    End
  161.    Begin TextBox txtFeetP 
  162.       BackColor       =   &H00C0C0C0&
  163.       DataField       =   "Feet"
  164.       DataSource      =   "dtaPerson"
  165.       Height          =   315
  166.       Left            =   960
  167.       TabIndex        =   12
  168.       Top             =   1140
  169.       Width           =   315
  170.    End
  171.    Begin TextBox txtInchesP 
  172.       BackColor       =   &H00C0C0C0&
  173.       DataField       =   "Inches"
  174.       DataSource      =   "dtaPerson"
  175.       Height          =   315
  176.       Left            =   1560
  177.       TabIndex        =   13
  178.       Top             =   1140
  179.       Width           =   315
  180.    End
  181.    Begin TextBox txtZipP 
  182.       BackColor       =   &H00C0C0C0&
  183.       DataField       =   "Zip"
  184.       DataSource      =   "dtaPerson"
  185.       Height          =   315
  186.       Left            =   7200
  187.       TabIndex        =   6
  188.       Top             =   540
  189.       Width           =   1095
  190.    End
  191.    Begin TextBox txtEyesP 
  192.       BackColor       =   &H00C0C0C0&
  193.       DataField       =   "Eyes"
  194.       DataSource      =   "dtaPerson"
  195.       Height          =   315
  196.       Left            =   7200
  197.       TabIndex        =   16
  198.       Top             =   1140
  199.       Width           =   735
  200.    End
  201.    Begin TextBox txtDOBP 
  202.       BackColor       =   &H00C0C0C0&
  203.       DataField       =   "DOB"
  204.       DataSource      =   "dtaPerson"
  205.       Height          =   315
  206.       Left            =   7200
  207.       TabIndex        =   10
  208.       Text            =   " "
  209.       Top             =   840
  210.       Width           =   915
  211.    End
  212.    Begin TextBox txtSexP 
  213.       BackColor       =   &H00C0C0C0&
  214.       DataField       =   "Sex"
  215.       DataSource      =   "dtaPerson"
  216.       Height          =   285
  217.       Left            =   8580
  218.       TabIndex        =   11
  219.       Top             =   840
  220.       Width           =   255
  221.    End
  222.    Begin Label lblID 
  223.       BackColor       =   &H00E0FFFF&
  224.       BorderStyle     =   1  'Fixed Single
  225.       DataField       =   "ID"
  226.       DataSource      =   "dtaPerson"
  227.       Height          =   315
  228.       Left            =   960
  229.       TabIndex        =   38
  230.       Top             =   240
  231.       Width           =   735
  232.    End
  233.    Begin Label Label5 
  234.       BackColor       =   &H00C0C0C0&
  235.       Caption         =   "Last:"
  236.       Height          =   255
  237.       Left            =   3240
  238.       TabIndex        =   36
  239.       Top             =   240
  240.       Width           =   495
  241.    End
  242.    Begin Label Label3 
  243.       BackColor       =   &H00C0C0C0&
  244.       Caption         =   "ID:"
  245.       Height          =   255
  246.       Left            =   660
  247.       TabIndex        =   37
  248.       Top             =   240
  249.       Width           =   315
  250.    End
  251.    Begin Label Label14 
  252.       BackColor       =   &H00C0C0C0&
  253.       Caption         =   "First:"
  254.       Height          =   255
  255.       Left            =   5280
  256.       TabIndex        =   35
  257.       Top             =   240
  258.       Width           =   495
  259.    End
  260.    Begin Label Label15 
  261.       BackColor       =   &H00C0C0C0&
  262.       Caption         =   "Init:"
  263.       Height          =   255
  264.       Left            =   6840
  265.       TabIndex        =   34
  266.       Top             =   240
  267.       Width           =   375
  268.    End
  269.    Begin Label Label16 
  270.       BackColor       =   &H00C0C0C0&
  271.       Caption         =   "Address:"
  272.       Height          =   255
  273.       Left            =   180
  274.       TabIndex        =   33
  275.       Top             =   540
  276.       Width           =   795
  277.    End
  278.    Begin Label Label17 
  279.       BackColor       =   &H00C0C0C0&
  280.       Caption         =   "City:"
  281.       Height          =   255
  282.       Left            =   3300
  283.       TabIndex        =   32
  284.       Top             =   540
  285.       Width           =   495
  286.    End
  287.    Begin Label Label18 
  288.       BackColor       =   &H00C0C0C0&
  289.       Caption         =   "State:"
  290.       Height          =   255
  291.       Left            =   5220
  292.       TabIndex        =   31
  293.       Top             =   540
  294.       Width           =   555
  295.    End
  296.    Begin Label Label19 
  297.       BackColor       =   &H00C0C0C0&
  298.       Caption         =   "Zip:"
  299.       Height          =   255
  300.       Left            =   6840
  301.       TabIndex        =   30
  302.       Top             =   540
  303.       Width           =   435
  304.    End
  305.    Begin Label Label20 
  306.       BackColor       =   &H00C0C0C0&
  307.       Caption         =   "DL#:"
  308.       Height          =   255
  309.       Left            =   480
  310.       TabIndex        =   29
  311.       Top             =   840
  312.       Width           =   495
  313.    End
  314.    Begin Label Label21 
  315.       BackColor       =   &H00C0C0C0&
  316.       Caption         =   "State:"
  317.       Height          =   255
  318.       Left            =   3180
  319.       TabIndex        =   28
  320.       Top             =   840
  321.       Width           =   555
  322.    End
  323.    Begin Label Label22 
  324.       BackColor       =   &H00C0C0C0&
  325.       Caption         =   "Type:"
  326.       Height          =   255
  327.       Left            =   5220
  328.       TabIndex        =   27
  329.       Top             =   840
  330.       Width           =   555
  331.    End
  332.    Begin Label Label23 
  333.       BackColor       =   &H00C0C0C0&
  334.       Caption         =   "DOB:"
  335.       Height          =   255
  336.       Left            =   6720
  337.       TabIndex        =   26
  338.       Top             =   840
  339.       Width           =   495
  340.    End
  341.    Begin Label Label24 
  342.       BackColor       =   &H00C0C0C0&
  343.       Caption         =   "Sex:"
  344.       Height          =   255
  345.       Left            =   8160
  346.       TabIndex        =   25
  347.       Top             =   840
  348.       Width           =   435
  349.    End
  350.    Begin Label Label25 
  351.       BackColor       =   &H00C0C0C0&
  352.       Caption         =   "Height:"
  353.       Height          =   255
  354.       Left            =   300
  355.       TabIndex        =   24
  356.       Top             =   1140
  357.       Width           =   615
  358.    End
  359.    Begin Label Label26 
  360.       BackColor       =   &H00C0C0C0&
  361.       Caption         =   "'"
  362.       Height          =   255
  363.       Left            =   1440
  364.       TabIndex        =   23
  365.       Top             =   1140
  366.       Width           =   135
  367.    End
  368.    Begin Label Label27 
  369.       BackColor       =   &H00C0C0C0&
  370.       Caption         =   "''"
  371.       Height          =   315
  372.       Left            =   1920
  373.       TabIndex        =   22
  374.       Top             =   1140
  375.       Width           =   195
  376.    End
  377.    Begin Label Label28 
  378.       BackColor       =   &H00C0C0C0&
  379.       Caption         =   "Weight:"
  380.       Height          =   255
  381.       Left            =   3060
  382.       TabIndex        =   21
  383.       Top             =   1140
  384.       Width           =   735
  385.    End
  386.    Begin Label Label29 
  387.       BackColor       =   &H00C0C0C0&
  388.       Caption         =   "Hair:"
  389.       Height          =   255
  390.       Left            =   5280
  391.       TabIndex        =   20
  392.       Top             =   1140
  393.       Width           =   495
  394.    End
  395.    Begin Label Label30 
  396.       BackColor       =   &H00C0C0C0&
  397.       Caption         =   "Eyes:"
  398.       Height          =   255
  399.       Left            =   6660
  400.       TabIndex        =   19
  401.       Top             =   1140
  402.       Width           =   555
  403.    End
  404. End
  405. Option Explicit
  406.  
  407. Sub cmdCancel_Click ()
  408.     GlobalPersonID = 0
  409.     Unload frmNewP
  410. End Sub
  411.  
  412. Sub cmdSave_Click ()
  413.     On Error GoTo CheckLenErr
  414.     Dim Namex As String
  415.     If txtLNameP <> "" And txtFNameP <> "" Then
  416.         dtaPerson.Recordset.Update
  417.         dtaPerson.Recordset.MoveLast
  418.         GlobalPersonID = dtaPerson.Recordset!ID
  419.  
  420.         Namex = txtLNameP
  421.         Namex = Namex & ", " & Trim$(txtFNameP)
  422.         If Not IsNull(dtaPerson.Recordset("Initial")) Then
  423.             Namex = Namex & ", " & Trim$(dtaPerson.Recordset("Initial"))
  424.         End If
  425.         Namex = Namex & " - " & dtaPerson.Recordset("ID")
  426.         VBWarn!cmbPerson.AddItem Namex
  427.  
  428.         Unload frmNewP
  429.     Else
  430.         MsgBox "Must have a first and last name"  , MB_EXCL , "Warning Ticket"
  431.         txtLNameP.SetFocus
  432.     End If
  433.     Exit Sub
  434. CheckLenErr:
  435.     If Err = 3163 Then
  436.         MsgBox "A value is too long, fix or cancel save" , MB_EXCL , "Warning Ticket"
  437.         Exit Sub
  438.     Else
  439.         MsgBox "Unexpected Error " & "'" & Err & "'" , MB_EXCL , "Warning Ticket"
  440.         Exit Sub
  441.     End If
  442.     Resume
  443.  
  444. End Sub
  445.  
  446. Sub Form_Activate ()
  447.     dtaPerson.Recordset.AddNew
  448.     txtLNameP.SetFocus
  449. End Sub
  450.  
  451. Sub txtDLStP_KeyPress (KeyAscii As Integer)
  452.     If (KeyAscii >= Asc("a")) And (KeyAscii <= Asc("z")) Then KeyAscii = KeyAscii - 32
  453. End Sub
  454.  
  455. Sub txtDLTypeP_KeyPress (KeyAscii As Integer)
  456.     If (KeyAscii >= Asc("a")) And (KeyAscii <= Asc("z")) Then KeyAscii = KeyAscii - 32
  457. End Sub
  458.  
  459. Sub txtDOBP_LostFocus ()
  460.     If (Not IsDate(txtDOBP.Text)) And (txtDOBP <> "") Then
  461.         MsgBox ("Enter a valid date of birth")  , MB_EXCL , "Warning Ticket"
  462.         txtDOBP.SetFocus
  463.     End If
  464. End Sub
  465.  
  466. Sub txtSexP_KeyPress (KeyAscii As Integer)
  467.     If (KeyAscii >= Asc("a")) And (KeyAscii <= Asc("z")) Then KeyAscii = KeyAscii - 32
  468. End Sub
  469.  
  470. Sub txtStateP_KeyPress (KeyAscii As Integer)
  471.     If (KeyAscii >= Asc("a")) And (KeyAscii <= Asc("z")) Then KeyAscii = KeyAscii - 32
  472. End Sub
  473.  
  474.